package top.lshaci.learning.oauth2.server.model;

import lombok.Builder;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * User
 *
 * @author lshaci
 * @since 1.0.0
 */
@Data
@Builder
@Accessors(chain = true)
public class User implements UserDetails {

    private String id;

    private String username;

    private String password;

    private boolean enabled;

    private String clientId;

    private Collection<SimpleGrantedAuthority> authorities;

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }
}
